﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommonUtils.Extend
{
    /// <summary>
    /// Collection扩展
    /// </summary>
    public static class ExCollection
    {
        [DebuggerStepThrough]
        public static void Each<TG>(this IEnumerable<TG> enumerable, Action<TG> action) where TG : class
        {
            foreach (TG item in enumerable)
            {
                action(item);
            }
        }

        [DebuggerStepThrough]
        public static void AddEnumerable<TG>(this ICollection<TG> collection, IEnumerable<TG> enumerable) where TG : class
        {
            enumerable.Each(collection.Add);
        }
    }
}
